import asyncio
from autogen_ext.models.openai import OpenAIChatCompletionClient
from autogen_core.models import UserMessage

async def chat_with_model():
    # 创建OpenAIChatCompletionClient对象
    model_client = OpenAIChatCompletionClient(model="deepseek-chat", base_url="https://api.deepseek.com",
                                              api_key="sk-6d775065fa8c405caebed674c125e67e",
                                              model_info={
                                                  "vision": False,
                                                  "function_calling": False,
                                                  "json_output": True,
                                                  "family": "unknown",
                                              })
    result = await model_client.create([UserMessage(content="中国的首都是什么?", source="user")])
    print(result.model_dump_json())

if __name__ == '__main__':
    asyncio.run(chat_with_model())